#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const ll mod = 1000000007;
using namespace std;

int N,K;
int cnt[maxn];
ll f[111][maxn],pre[maxn];

ll solve(){
    for(int i = 0;i<=K;i++) f[1][i] = (i<=cnt[1])? 1:0;
    for(int i = 2;i<=N;i++){ // child
        memset(pre,0,sizeof pre);
        pre[0] = f[i-1][0];
        for(int j = 1;j<=K;j++) pre[j] = (f[i-1][j] + pre[j-1]);
        for(int j = K;j>=0;j--){ //want to use
            if(j-cnt[i]-1 >= 0) f[i][j] = pre[j] - pre[j-cnt[i]-1];
            else f[i][j]  =  pre[j];
            f[i][j] %= mod;
        }
    }
    return f[N][K];
}

int main(){
    // debug;
    ios;

    cin>>N>>K;
    for(int i = 1;i<=N;i++) cin>>cnt[i];
    cout<<solve()<<'\n';

    
    return 0;
}
